using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;

namespace DeSleeper.Client.WakeUp
{
    public class LocalWakeUpDestination : WakeUpDestination
    {
        private static readonly List<WakeUpMethod> _methods = new List<WakeUpMethod> {new LocalWakeUpMethod()};
        private static readonly List<WakeUpMethod> _frozenMethods =
            _methods.Select(method => (WakeUpMethod)method.GetCurrentValueAsFrozen()).ToList();

        protected override IEnumerable<WakeUpMethod> InnerMethods { get { return IsFrozen ? _frozenMethods : _methods; } }

        /// <summary>
        /// A description of the target used to identify it to the user.
        /// </summary>
        public override string Description
        {
            get { return "Wake up a machine on your local network."; }
        }

        /// <summary>
        /// Identifier used to identify target to code.
        /// </summary>
        public override string Id { get { return "Local"; } set { } }

        ///<summary>
        /// Creates a new instance to support cloning.
        ///</summary>
        protected override Freezable CreateInstanceCore()
        {
            return new LocalWakeUpDestination();
        }

        public override void WakeUp(TargetComputer targetComputer)
        {
            targetComputer.WakeUp(null);
        }
    }
}